public class ThreadMethod {

    //继承thread
    class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println("线程运行代码");
        }
    }
    //实现Runnable
    class MyRunnable implements Runnable{
        @Override
        public void run() {

        }
    }


    public static void main(String[] args) {
        //多线程方法
        //匿名内部类Thread
        Thread t1=new Thread(){
            @Override
            public void run() {
                super.run();
            }
        };
        //匿名内部类创建Runnable
        Thread t2=new Thread(new Runnable() {
            @Override
            public void run() {

            }
        });
        //lambda表达式创建Runnable
        Thread t3 = new Thread(()->{
            System.out.println("使用匿名类创建Thread子类对象");
        });
    }

    //
    //
}
